<?php if(!defined('BASEPATH')) exit('No direct script access allowed');

class Categories extends CI_Model {
    
    function getCategories() {
        $query = $this->db->select('*')->from('categories')->get();
        if($query->num_rows() > 0) {
            $rows = array();
            foreach($query->result() as $row) {
                $rows[] = $row;
            }
            return $rows;
        }
    }
    
    function removeCategory($id) {
        $this->db->query("DELETE FROM categories WHERE id='".$id."'");
    }
    
}